import request from './request'

// 获取商品的所有图片
export const getProductImages = (productId: number) => {
  return request({
    url: `/product-images/product/${productId}`,
    method: 'get'
  })
}

// 根据ID获取图片
export const getProductImageById = (id: number) => {
  return request({
    url: `/product-images/${id}`,
    method: 'get'
  })
}

// 创建商品图片
export const createProductImage = (data: any) => {
  return request({
    url: '/product-images',
    method: 'post',
    data
  })
}

// 更新商品图片
export const updateProductImage = (id: number, data: any) => {
  return request({
    url: `/product-images/${id}`,
    method: 'put',
    data
  })
}

// 删除商品图片
export const deleteProductImage = (id: number) => {
  return request({
    url: `/product-images/${id}`,
    method: 'delete'
  })
} 